package file.day9_18.day03.homework;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) throws IOException {
        String name,pwd,nick;
        int age;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入name：");
        name = scanner.nextLine();
        System.out.println("请输入pwd：");
        pwd = scanner.nextLine();
        System.out.println("请输入nick：");
        nick = scanner.nextLine();
        System.out.println("请输入age：");
        age = scanner.nextInt();

        User user = new User(name,pwd,nick,age);

        FileOutputStream fos = new FileOutputStream(name+".obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(user);
        System.out.println("写出完成");

        oos.close();


    }
}
